package com.cosina.ex;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.cosina.ex.R.layout;

public class Startup extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    
	    
	    final Button button = new Button(this);
	    button.setText("start");
	    button.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				if(button.getText().toString().equals("start")){
					Startup.this.startService(new Intent(Startup.this,CloseYouMouth.class));
					button.setText("stop");
				}else{
					Startup.this.stopService(new Intent(Startup.this,CloseYouMouth.class));
					button.setText("start");
				}
			}});
	    ViewGroup layout = (ViewGroup)LayoutInflater.from(this).inflate(R.layout.main, null);
	    layout.addView(button);
	    this.setContentView(layout);
	}

}
